﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
using System.Text;
using Data.Abstract;
using System.Data.SQLite;

namespace Data
{
    public class CollectionVisitante : BaseCollection<SimpleVisitante>
    {
        #region Propiedades
        DalVisitante _Dal;

        #endregion
        #region Eventos
        public CollectionVisitante(SQLiteConnection conn)
        {
            this._Dal = new DalVisitante(conn);
        }
        public CollectionVisitante()
        {
        }
        public CollectionVisitante(CollectionVisitante collection)
        {
            foreach(SimpleVisitante s in collection)
            {
                this.Add(s);
            }
        }
        #endregion
        #region Metodos
        public void Add(CollectionVisitante collection)
        {
            foreach(SimpleVisitante s in collection)
            {
                this.Add(s);
            }
        }
            public CollectionVisitante LoadByNewsId(int newsId)
        {
            this._Dal = new DalVisitante(getConn(newsId));
            LoadByData(this._Dal.GetAll());
            return this;
        }

        #endregion
        SQLiteConnection getConn(int newsId)
        {
           
                //News n = new News();
                //n.Load(newsId);
                //string tempDir = Data.Configuration.Context.CurrentContext.GetTempPath(n.Simple.RespRandom, Data.Configuration.TipoBaseEnum.System).FullName;
                //System.IO.FileInfo fi = new System.IO.FileInfo(System.IO.Path.Combine(tempDir, "ClientInfo.db"));
            return new SQLiteConnection("data source=");//+ fi.FullName);
        }
    }
}
